package www.dashu.com.dao;

import www.dashu.com.dao.base.BaseDao;
import www.dashu.com.domain.CProductAttributeValue;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CProductAttributeValueDao extends BaseDao<CProductAttributeValue,Long> {

    @Query(value = "select o from CProductAttributeValue o where o.id =:id")
    List<CProductAttributeValue> getCProductAttributeValueById(@Param("id") Long id);

    @Modifying
    @Query(value = "delete from CProductAttributeValue o where o.id = ?1")
    void deleteCProductAttributeValueById(Long id);

    @Modifying
    @Query(value = "delete from CProductAttributeValue o where o.productId = ?1")
    void deleteByProductId(Long productId);

}